# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=qt5-qttranslations
pkgver=5.15.10_git20230424
pkgrel=1
_module="${pkgname#qt5-}"
_pkgver=a680686754d84b91d4cc4252a2fb8af0c58f5f49
_fullname=$_module-$_pkgver
pkgdesc="Qt5 - QtTranslations module"
url="https://www.qt.io/developers/"
arch="noarch"
license="GPL-3.0-only AND Qt-GPL-exception-1.0"
makedepends="qt5-qttools-dev"
source="https://dev.alpinelinux.org/archive/qt/$_fullname.tar.xz"
builddir="$srcdir/$_fullname"

_disturl="dev.alpinelinux.org:/archive/qt/"
snapshot() {
	clean
	makedepends="git xz rsync tar" deps
	mkdir -p "$srcdir" && cd "$srcdir"
	git clone --filter=tree:0 https://invent.kde.org/qt/qt/$_module.git .
	git archive --format tar --prefix=$_fullname/ $_pkgver > "$SRCDEST"/$_fullname.tar
	xz -vv -T0 -9 -e "$SRCDEST"/$_fullname.tar
	rsync --progress -La "$SRCDEST"/$_fullname.tar.xz $_disturl
}

prepare() {
	default_prepare

	# We need to make the build system think we're running in a git repository
	# so it correctly symlinks during the build
	mkdir .git
}

build() {
	qmake-qt5
	make
}

check() {
	make check
}
package() {
	make INSTALL_ROOT="$pkgdir" install

	install -d "$pkgdir"/usr/share/licenses
	ln -s qt5-base "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
a741b9cf9d9a40291eccc5ca527e618f9c92f98c2c626ddfff7387ca367901267e98c0e39a7b8c603998b2a0d38f864bc2b501dc87d77fd8d7f7ea4f2b87f2b5  qttranslations-a680686754d84b91d4cc4252a2fb8af0c58f5f49.tar.xz
"
